﻿using System;
using FlowCanvas;
using FlowCanvas.Nodes;

namespace Yoozoo.Gameplay.Liberty.StreetEvent
{
    public class StreetFinishRacingEvent : EventNode
    {
        public static Action OnFinishRacing;
        
        private FlowOutput onFinish;
        
        protected override void RegisterPorts()
        {
            onFinish = AddFlowOutput("onFinish");
        }
        
        public override void OnGraphStarted()
        {
            OnFinishRacing += OnFinishRacingFunc;
        }

        public override void OnGraphStoped()
        {
            OnFinishRacing -= OnFinishRacingFunc;
        }

        private void OnFinishRacingFunc()
        {
            onFinish.Call(new Flow());
        }
        
    }
}